<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>个人中心</title>
		<link rel="stylesheet" type="text/css" href="css/style_register.css" />
		<SCRIPT language="javascript" src="js/jquery-3.1.1.js" type="text/javascript"></SCRIPT>
		<script src="js/base.js"></script>
		<script src="js/md5.js"></script>
	</head>

	<body>
		<!--header===================================-->
		<header>
			<h1><a href="#"><img src="img/Backicon.png"></a></h1>

			<div class="header_middle">
				个人中心
			</div>
			<div class="header_right">
			</div>
		</header>

		<!--main=======================================-->
		<section id="main">
			<form action="#">
				<div>
					<input id="signName" type="text" value="" name="mp" required placeholder="输入手机号" />
				</div>
				<div>
					<input id="password" type="password" value="" name="password" required placeholder="输入密码" />
				</div>
				<div class="div_button">
					<button onclick="return signIn();">点击登录</button>
					<button>点击注册</button>
				</div>
				<script>
					function signIn(){
						let url="http://localhost:8888/qf/user/signIn";
						let method="POST";
						let json={};
						json.signInName=document.getElementById("signName").value;
						json.password=md5(document.getElementById("password").value);
						//网络请求
						$.rest(url,method,json,function(r){
							if(r.code==200){
								//登陆成功
								let user=r.result.user;
								let token=r.result.token;
								localStorage.setItem("token",token);
								localStorage.setItem("userId",user.id);
								localStorage.setItem("username",user.username);
								localStorage.setItem("nickname",user.nickname);
								localStorage.setItem("gender",user.gender);
								localStorage.setItem("telephone",user.telephone);
								localStorage.setItem("email",user.email);
								localStorage.setItem("iconLink",user.iconLink);
								window.location.href="聊天列表.html";
							}
						});
						return false;
					}
				</script>
				<div>
					<button>刷脸登录</button>
				</div>
			</form>
		</section>

	</body>

</html>